package com.tianyi.sfzy1.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.tianyi.sfzy1.domain.Psychologicalassessment;
import com.tianyi.sfzy1.mapper.PsychologicalassessmentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PsychologicalassessmentService {
@Autowired
    PsychologicalassessmentMapper psychologicalassessmentMapper;

 public int addPsychologicalassessment(Psychologicalassessment psychologicalassessment) {
     return  psychologicalassessmentMapper.insert(psychologicalassessment);

 }
 public int deletePsychologicalassessment(Long id) {
     return psychologicalassessmentMapper.deleteByPrimaryKey(id);

 }
 public int deleteManyPsychologicalassessment(List<Integer> ids) {
     return psychologicalassessmentMapper.deleteMany(ids);

 }
 public int deleteManyPsychologicalassessmentByPsychologicalassessmentId(Long id) {
     return psychologicalassessmentMapper.deleteByPrimaryKey(id);
 }

 public int updateSelective(Psychologicalassessment psychologicalassessment) {
     return psychologicalassessmentMapper.updateByPrimaryKeySelective(psychologicalassessment);
 }
 public List<Psychologicalassessment> selectAllPsychologicalassessment() {
     return psychologicalassessmentMapper.selectAll();
 }
//模糊查询
    public List<Psychologicalassessment> selectPsychologicalassessmentBy(Psychologicalassessment example) {
     return psychologicalassessmentMapper.selectByExample(example);
    }
//    分页查询
    public PageInfo<Psychologicalassessment> fenyechaxun(Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<Psychologicalassessment> list = psychologicalassessmentMapper.selectAll();
        PageInfo<Psychologicalassessment> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

}
